#ifndef PROFILE_H
#define PROFILE_H

#include <QMainWindow>

#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QMouseEvent>
#include <QPainter>
#include <QRegion>
#include "ElaAppBar.h"
#include "ElaWidget.h"
#include "Def.h"

//class profilePrivate;
class  profile : public ElaWidget
{
    Q_OBJECT
    //Q_Q_CREATE(profile)
    //Q_TAKEOVER_NATIVEEVENT_H
public:
    explicit profile(ElaWidget *parent = nullptr);
    //int row = 0;
    int deleteflag = 0;
    bool Found = 0;
    QString Time = "";
    // const QString filePath{"./../../../Patient_Document"};
    const QString filePath{"resource/patients"};
    bool color = 0;
    void closeEvent(QCloseEvent *event) override {
        // 设置关闭标志位
        proFileClosed();
        // 其他清理工作...
        QWidget::closeEvent(event); // 调用基类实现以处理默认行为
    }

    void findDoc();
signals:
        void proFileClosed();

protected:
        // 支持窗口拖动

        /*void mousePressEvent(QMouseEvent *event) override
        {
            if (event->button() == Qt::LeftButton) {
                if (isMaximized()) {
                    // 如果窗口是全屏状态，则退出全屏
                    showNormal();
                    // 调整窗口位置，使其跟随鼠标
                    // 计算窗口的新位置
                    QPoint cursorPos = event->globalPos();  // 鼠标的全局位置
                    QSize windowSize = size();  // 窗口的大小
                    QPoint newTopLeft = cursorPos - QPoint(windowSize.width() / 2, windowSize.height() / 2);  // 窗口左上角的新位置

                    // 移动窗口到新位置
                    move(newTopLeft);
                } else {
                    // 记录鼠标点击位置
                    dragPosition = event->globalPos() - frameGeometry().topLeft();
                }
                event->accept();
            }
        }

        void mouseMoveEvent(QMouseEvent *event) override
        {
            if (event->buttons() & Qt::LeftButton) {
                move(event->globalPos() - dragPosition);
                event->accept();
            }
        }
*/


private:
    QPoint dragPosition;
    QString _name{""};
    QString _age{""};
    QString _gender{""};
    QString _zone{""};
    QString _Id{""};
    QString _date{""};
    QString _diagnosis{""};
    QString _bodycheck{""};
    QString _complaint{""};
    QString _presenthistory{""};
    QString _anamnesis{""};
    QString _notes{""};

};

#endif // PROFILE_H
